﻿using System;
using System.Collections.Generic;
using FamilyBook.Core.Entities;

namespace FamilyBook.UI.WPF.ViewModels
{
    public class TransactionDetailsViewModel : BaseDetailsViewModel<Transaction>
    {
        public TransactionDetailsViewModel(Transaction transaction, IList<Product> products, IList<Account> accounts)
            :base(transaction)
        {
            this.Accounts = accounts;
            this.Products = products;
        }

        public IList<Account> Accounts { get; private set; }
        public Account SelectedSrcAccount
        {
            get { return Model.SrcAccount; }
            set 
            { 
                Model.SrcAccount = value;
                RaisePropertyChanged(() => SelectedSrcAccount);
            }
        }
        public Account SelectedDstAccount
        {
            get { return Model.DstAccount; }
            set
            {
                Model.DstAccount = value;
                RaisePropertyChanged(() => SelectedDstAccount);
            }
        }

        public decimal Amount
        {
            get { return Model.Amount; }
            set
            {
                Model.Amount = value;
                RaisePropertyChanged(() => Amount);
            }
        }
        public string Comment
        {
            get { return Model.Comment; }
            set
            {
                Model.Comment = value;
                RaisePropertyChanged(Comment);
            }
        }

        public IList<Product> Products { get; private set; }
        public Product SelectedProduct
        {
            get { return Model.Product; }
            set
            {
                Model.Product = value;
                RaisePropertyChanged(() => SelectedProduct);
            }
        }

        public DateTime TransactionDate
        {
            get { return Model.TransactionDate; }
            set
            {
                Model.TransactionDate = value;
                RaisePropertyChanged(() => TransactionDate);
            }
        }
    }
}
